package com.whfc.iot.mach.entity;

import com.whfc.iot.mach.constant.MsgConst;
import lombok.Data;

import java.util.List;

/**
 * @Description: 硬件报警-请求
 * @author: xugcheng
 * @version: 1.0
 * @date: 2021-01-06 11:04
 */
@Data
public class MachMsg0x87 extends MachMsg {

    /**
     * 参数数量
     */
    int paramNum;

    /**
     * 参数列表
     */
    private List<MachParamItem> paramList;

    public MachMsg0x87() {
        this.setCmd(MsgConst.DOWNSTREAM_CMD_0x87);
    }

    @Override
    public int getDataLength() {
        int dataLength = 0;
        if (paramList != null && paramList.size() > 0) {
            for (MachParamItem item : paramList) {
                dataLength += item.dataLength();
            }
        }
        return dataLength + 1;
    }
}
